﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Modeling_Sub_Pages_NewsPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["WelcomeUser"] != null)
        {
            if (Session["EmployeeID"] != null && Session["Role"].ToString().Equals("ADM"))
            {
            }
            else
            {
                Response.Redirect("~/LoginMessage.aspx?id=1");
            }
        }
        else
        {
            Response.Redirect("~/Login.aspx?id=2");
        }
    }
    
    protected void btnReset_Click(object sender, EventArgs e)
    {
        txtDName.Text = "";
        txtDescription.Text = "";
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        UniversityDatabaseManagerment udm = new UniversityDatabaseManagerment();
        
        string name = txtDName.Text;
        string description = txtDescription.Text;

        if (udm.addDepartment(udm.createConnection(), name,description))
        {
            Response.Redirect("MaintainMessage.aspx?ID=4");
        }
        else
        {
            Response.Redirect("MaintainMessage.aspx?ID=5");
        }

           
    }
    
}